/**
 * Creat by TanLei
 * Description:
 * User:86183
 * Date:2022-05-10
 * Time:22:42
 */
class MyThread2 extends Thread {
    @Override
    public void run() {
        while (true) {
            System.out.println("hello thread2");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}

public class Demo2 {
    public static void main(String[] args) {
        MyThread2 myThread2 = new MyThread2();
        myThread2.start();
        while (true){
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }
}
